home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / Balloons.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  10.8 KB  |  312 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Balloons.h
  3.  
  4.      Contains:    Balloon Help Package Interfaces.
  5.  
  6.      Version:    Technology:    System 7.0
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1990-1993, 1995-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __BALLOONS__
  18. #define __BALLOONS__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __QUICKDRAW__
  24. #include <Quickdraw.h>
  25. #endif
  26. #ifndef __MENUS__
  27. #include <Menus.h>
  28. #endif
  29. #ifndef __TEXTEDIT__
  30. #include <TextEdit.h>
  31. #endif
  32. #ifndef __ERRORS__
  33. #include <Errors.h>
  34. #endif
  35.  
  36.  
  37.  
  38. #if PRAGMA_ONCE
  39. #pragma once
  40. #endif
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45.  
  46. #if PRAGMA_IMPORT
  47. #pragma import on
  48. #endif
  49.  
  50. #if PRAGMA_STRUCT_ALIGN
  51.     #pragma options align=mac68k
  52. #elif PRAGMA_STRUCT_PACKPUSH
  53.     #pragma pack(push, 2)
  54. #elif PRAGMA_STRUCT_PACK
  55.     #pragma pack(2)
  56. #endif
  57.  
  58.  
  59. /* • constants*/
  60.  
  61.  
  62. enum {
  63.     kTopLeftTipPointsLeftVariant = 0,
  64.     kTopLeftTipPointsUpVariant    = 1,
  65.     kTopRightTipPointsUpVariant    = 2,
  66.     kTopRightTipPointsRightVariant = 3,
  67.     kBottomRightTipPointsRightVariant = 4,
  68.     kBottomRightTipPointsDownVariant = 5,
  69.     kBottomLeftTipPointsDownVariant = 6,
  70.     kBottomLeftTipPointsLeftVariant = 7,
  71.     kBalloonVariantCount        = 8
  72. };
  73.  
  74. typedef SInt16                             BalloonVariant;
  75.  
  76. enum {
  77.     hmBalloonHelpVersion        = 0x0002,                        /* The real version of the Help Manager */
  78.     kHMHelpMenuID                = -16490,                        /* Resource ID and menu ID of help menu */
  79.     kHMAboutHelpItem            = 1,                            /* help menu item number of About Balloon Help… */
  80.     kHMShowBalloonsItem            = 3,                            /* help menu item number of Show/Hide Balloons */
  81.     kHMHelpID                    = -5696,                        /* ID of various Help Mgr package resources (in Pack14 range) */
  82.     kBalloonWDEFID                = 126                            /* Resource ID of the WDEF proc used in standard balloons */
  83. };
  84.  
  85.  
  86. enum {
  87.                                                                 /* Dialog item template type constant */
  88.     helpItem                    = 1                                /* key value in DITL template that corresponds to the help item */
  89. };
  90.  
  91.  
  92. enum {
  93.                                                                 /* Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  94.     hmDefaultOptions            = 0,                            /* default options for help manager resources */
  95.     hmUseSubID                    = 1,                            /* treat resID's in resources as subID's of driver base ID (for Desk Accessories) */
  96.     hmAbsoluteCoords            = 2                                /* ignore window port origin and treat rectangles as absolute coords (local to window) */
  97. };
  98.  
  99.  
  100. enum {
  101.     hmSaveBitsNoWindow            = 4,                            /* don't create a window, just blast bits on screen. No update event is generated */
  102.     hmSaveBitsWindow            = 8,                            /* create a window, but restore bits behind window when window goes away & generate update event */
  103.     hmMatchInTitle                = 16                            /* for hwin resources, match string anywhere in window title string */
  104. };
  105.  
  106.  
  107. enum {
  108.                                                                 /* Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  109.     kHMStringItem                = 1,                            /* pstring used in resource */
  110.     kHMPictItem                    = 2,                            /* 'PICT' ResID used in resource */
  111.     kHMStringResItem            = 3,                            /* 'STR#' ResID & index used in resource */
  112.     kHMTEResItem                = 6,                            /* Styled Text Edit ResID used in resource ('TEXT' & 'styl') */
  113.     kHMSTRResItem                = 7,                            /* 'STR ' ResID used in resource */
  114.     kHMSkipItem                    = 256,                            /* don't display a balloon */
  115.     kHMCompareItem                = 512,                            /* Compare pstring in menu item w/ PString in resource item ('hmnu' only) */
  116.     kHMNamedResourceItem        = 1024,                            /* Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) */
  117.     kHMTrackCntlItem            = 2048                            /* Reserved */
  118. };
  119.  
  120.  
  121. enum {
  122.                                                                 /* Constants for hmmHelpType's when filling out HMMessageRecord */
  123.     khmmString                    = 1,                            /* help message contains a PString */
  124.     khmmPict                    = 2,                            /* help message contains a resource ID to a 'PICT' resource */
  125.     khmmStringRes                = 3,                            /* help message contains a res ID & index to a 'STR#' resource */
  126.     khmmTEHandle                = 4,                            /* help message contains a Text Edit handle */
  127.     khmmPictHandle                = 5,                            /* help message contains a Picture handle */
  128.     khmmTERes                    = 6,                            /* help message contains a res ID to 'TEXT' & 'styl' resources */
  129.     khmmSTRRes                    = 7,                            /* help message contains a res ID to a 'STR ' resource */
  130.     kHMEnabledItem                = 0                                /* item is enabled, but not checked or control value = 0 */
  131. };
  132.  
  133.  
  134. enum {
  135.                                                                 /* ResTypes for Styled TE Handles in Resources */
  136.     kHMTETextResType            = FOUR_CHAR_CODE('TEXT'),        /* Resource Type of text data for styled TE record w/o style info */
  137.     kHMTEStyleResType            = FOUR_CHAR_CODE('styl')        /* Resource Type of style information for styled TE record */
  138. };
  139.  
  140.  
  141. enum {
  142.     kHMDisabledItem                = 1,                            /* item is disabled, grayed in menus or disabled in dialogs */
  143.     kHMCheckedItem                = 2,                            /* item is enabled, and checked or control value = 1 */
  144.     kHMOtherItem                = 3,                            /* item is enabled, and control value > 1 */
  145.                                                                 /* Method parameters to pass to HMShowBalloon */
  146.     kHMRegularWindow            = 0,                            /* Create a regular window floating above all windows */
  147.     kHMSaveBitsNoWindow            = 1,                            /* Just save the bits and draw (for MDEF calls) */
  148.     kHMSaveBitsWindow            = 2                                /* Regular window, save bits behind, AND generate update event */
  149. };
  150.  
  151.  
  152. enum {
  153.                                                                 /* Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages */
  154.     kHMMenuResType                = FOUR_CHAR_CODE('hmnu'),        /* ResType of help resource for supporting menus */
  155.     kHMDialogResType            = FOUR_CHAR_CODE('hdlg'),        /* ResType of help resource for supporting dialogs */
  156.     kHMWindListResType            = FOUR_CHAR_CODE('hwin'),        /* ResType of help resource for supporting windows */
  157.     kHMRectListResType            = FOUR_CHAR_CODE('hrct'),        /* ResType of help resource for rectangles in windows */
  158.     kHMOverrideResType            = FOUR_CHAR_CODE('hovr'),        /* ResType of help resource for overriding system balloons */
  159.     kHMFinderApplResType        = FOUR_CHAR_CODE('hfdr')        /* ResType of help resource for custom balloon in Finder */
  160. };
  161.  
  162.  
  163. struct HMStringResType {
  164.     short                             hmmResID;
  165.     short                             hmmIndex;
  166. };
  167. typedef struct HMStringResType            HMStringResType;
  168.  
  169. struct HMMessageRecord {
  170.     SInt16                             hmmHelpType;
  171.     union {
  172.         Str255                             hmmString;
  173.         SInt16                             hmmPict;
  174.         TEHandle                         hmmTEHandle;
  175.         HMStringResType                 hmmStringRes;
  176.         SInt16                             hmmPictRes;
  177.         PicHandle                         hmmPictHandle;
  178.         SInt16                             hmmTERes;
  179.         SInt16                             hmmSTRRes;
  180.     }                                 u;
  181. };
  182. typedef struct HMMessageRecord            HMMessageRecord;
  183.  
  184. typedef HMMessageRecord *                HMMessageRecPtr;
  185. typedef CALLBACK_API( OSErr , TipFunctionProcPtr )(Point tip, RgnHandle structure, Rect *r, BalloonVariant *balloonVariant);
  186. typedef STACK_UPP_TYPE(TipFunctionProcPtr)                         TipFunctionUPP;
  187. enum { uppTipFunctionProcInfo = 0x00003FE0 };                     /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  188. #define NewTipFunctionProc(userRoutine)                         (TipFunctionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTipFunctionProcInfo, GetCurrentArchitecture())
  189. #define CallTipFunctionProc(userRoutine, tip, structure, r, balloonVariant)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppTipFunctionProcInfo, (tip), (structure), (r), (balloonVariant))
  190. /*  Public Interfaces  */
  191. EXTERN_API( OSErr )
  192. HMGetHelpMenuHandle                (MenuHandle *            mh)                                    THREEWORDINLINE(0x303C, 0x0200, 0xA830);
  193.  
  194. EXTERN_API( OSErr )
  195. HMShowBalloon                    (const HMMessageRecord * inHelpMessage,
  196.                                  Point                     inTip,
  197.                                  Rect *                    inHotRect, /* can be NULL */
  198.                                  TipFunctionUPP         inTipProc,
  199.                                  SInt16                 inWindowProcID,
  200.                                  BalloonVariant         inBalloonVariant,
  201.                                  SInt16                 inMethod)                            THREEWORDINLINE(0x303C, 0x0B01, 0xA830);
  202.  
  203. EXTERN_API( OSErr )
  204. HMShowMenuBalloon                (SInt16                 itemNum,
  205.                                  SInt16                 itemMenuID,
  206.                                  SInt32                 itemFlags,
  207.                                  SInt32                 itemReserved,
  208.                                  Point                     tip,
  209.                                  Rect *                    alternateRect, /* can be NULL */
  210.                                  TipFunctionUPP         tipProc,
  211.                                  SInt16                 theProc,
  212.                                  BalloonVariant         balloonVariant)                        THREEWORDINLINE(0x303C, 0x0E05, 0xA830);
  213.  
  214. EXTERN_API( OSErr )
  215. HMRemoveBalloon                    (void)                                                        THREEWORDINLINE(0x303C, 0x0002, 0xA830);
  216.  
  217. EXTERN_API( OSErr )
  218. HMGetIndHelpMsg                    (ResType                 inWhichResType,
  219.                                  SInt16                 inWhichResID,
  220.                                  SInt16                 inMessageIndex,
  221.                                  SInt16                 inMessageState,
  222.                                  UInt32 *                outOptions,
  223.                                  Point *                outTip,
  224.                                  Rect *                    outHotRect,
  225.                                  SInt16 *                outWindowProcID,
  226.                                  BalloonVariant *        outBalloonVariant,
  227.                                  HMMessageRecord *        outHelpMessage,
  228.                                  SInt16 *                outMessageCount)                    THREEWORDINLINE(0x303C, 0x1306, 0xA830);
  229.  
  230. EXTERN_API( Boolean )
  231. HMIsBalloon                        (void)                                                        THREEWORDINLINE(0x303C, 0x0007, 0xA830);
  232.  
  233. EXTERN_API( Boolean )
  234. HMGetBalloons                    (void)                                                        THREEWORDINLINE(0x303C, 0x0003, 0xA830);
  235.  
  236. EXTERN_API( OSErr )
  237. HMSetBalloons                    (Boolean                 flag)                                THREEWORDINLINE(0x303C, 0x0104, 0xA830);
  238.  
  239. EXTERN_API( OSErr )
  240. HMSetFont                        (SInt16                 font)                                THREEWORDINLINE(0x303C, 0x0108, 0xA830);
  241.  
  242. EXTERN_API( OSErr )
  243. HMSetFontSize                    (UInt16                 fontSize)                            THREEWORDINLINE(0x303C, 0x0109, 0xA830);
  244.  
  245. EXTERN_API( OSErr )
  246. HMGetFont                        (SInt16 *                font)                                THREEWORDINLINE(0x303C, 0x020A, 0xA830);
  247.  
  248. EXTERN_API( OSErr )
  249. HMGetFontSize                    (UInt16 *                fontSize)                            THREEWORDINLINE(0x303C, 0x020B, 0xA830);
  250.  
  251. EXTERN_API( OSErr )
  252. HMSetDialogResID                (SInt16                 resID)                                THREEWORDINLINE(0x303C, 0x010C, 0xA830);
  253.  
  254. EXTERN_API( OSErr )
  255. HMSetMenuResID                    (SInt16                 menuID,
  256.                                  SInt16                 resID)                                THREEWORDINLINE(0x303C, 0x020D, 0xA830);
  257.  
  258. EXTERN_API( OSErr )
  259. HMBalloonRect                    (const HMMessageRecord * inMessage,
  260.                                  Rect *                    outRect)                            THREEWORDINLINE(0x303C, 0x040E, 0xA830);
  261.  
  262. EXTERN_API( OSErr )
  263. HMBalloonPict                    (const HMMessageRecord * inMessage,
  264.                                  PicHandle *            outPict)                            THREEWORDINLINE(0x303C, 0x040F, 0xA830);
  265.  
  266. EXTERN_API( OSErr )
  267. HMScanTemplateItems                (SInt16                 whichID,
  268.                                  SInt16                 whichResFile,
  269.                                  ResType                 whichType)                            THREEWORDINLINE(0x303C, 0x0410, 0xA830);
  270.  
  271. EXTERN_API( OSErr )
  272. HMExtractHelpMsg                (ResType                 inType,
  273.                                  SInt16                 inResID,
  274.                                  SInt16                 inMessageIndex,
  275.                                  SInt16                 inMessageState,
  276.                                  HMMessageRecord *        outMessage)                            THREEWORDINLINE(0x303C, 0x0711, 0xA830);
  277.  
  278. EXTERN_API( OSErr )
  279. HMGetDialogResID                (SInt16 *                resID)                                THREEWORDINLINE(0x303C, 0x0213, 0xA830);
  280.  
  281. EXTERN_API( OSErr )
  282. HMGetMenuResID                    (SInt16                 menuID,
  283.                                  SInt16 *                resID)                                THREEWORDINLINE(0x303C, 0x0314, 0xA830);
  284.  
  285. EXTERN_API( OSErr )
  286. HMGetBalloonWindow                (WindowPtr *            window)                                THREEWORDINLINE(0x303C, 0x0215, 0xA830);
  287.  
  288.  
  289.  
  290.  
  291.  
  292. #if PRAGMA_STRUCT_ALIGN
  293.     #pragma options align=reset
  294. #elif PRAGMA_STRUCT_PACKPUSH
  295.     #pragma pack(pop)
  296. #elif PRAGMA_STRUCT_PACK
  297.     #pragma pack()
  298. #endif
  299.  
  300. #ifdef PRAGMA_IMPORT_OFF
  301. #pragma import off
  302. #elif PRAGMA_IMPORT
  303. #pragma import reset
  304. #endif
  305.  
  306. #ifdef __cplusplus
  307. }
  308. #endif
  309.  
  310. #endif /* __BALLOONS__ */
  311.  
  312.